import {
  BaseEntity,
  Column,
  Entity,
  PrimaryColumn,
  PrimaryGeneratedColumn,
} from 'typeorm'

// 采购申请表
@Entity({ name: 'purchase' })
export class Purchase extends BaseEntity {
  // 自增主键
  @PrimaryGeneratedColumn({ type: 'int', name: 'id' })
  id: number

  // 采购申请编号
  @PrimaryColumn({
    type: 'varchar',
    name: 'purchaseCode',
  })
  purchaseCode: string

  // 采购名称
  @Column({
    type: 'varchar',
    name: 'purchaseName',
  })
  purchaseName: string

  // 申请人
  @Column({
    type: 'varchar',
    name: 'purchasePerson',
  })
  purchasePerson: string

  // 申请人id
  @Column({
    type: 'int',
    name: 'purchasePersonId',
  })
  purchasePersonId: number

  // 申请部门
  @Column({
    type: 'varchar',
    name: 'purchaseBranch',
    nullable: true,
  })
  purchaseBranch: string

  // 申请部门id
  @Column({
    type: 'int',
    name: 'purchaseBranchId',
    nullable: true,
  })
  purchaseBranchId: number

  // 采购金额
  @Column({
    type: 'double',
    name: 'purchaseAmount',
  })
  purchaseAmount: number

  // 采购状态  0 进行中 1 驳回 2 成功
  @Column({
    type: 'varchar',
    name: 'purchaseStatus',
  })
  purchaseStatus: string

  // 预算id
  @Column({
    type: 'int',
    name: 'budgetId',
  })
  budgetId: number

  // 申请日期
  @Column({
    type: 'varchar',
    name: 'purchaseDate',
  })
  purchaseDate: string

  // 申请理由
  @Column({
    type: 'varchar',
    name: 'purchaseReason',
  })
  purchaseReason: string

  // 资产类型id
  @Column({
    type: 'int',
    name: 'purchaseTypeId',
  })
  purchaseTypeId: number

  // 数量
  @Column({
    type: 'int',
    name: 'number',
    nullable: true,
  })
  number: number

  // 批复
  @Column({
    type: 'varchar',
    name: 'reason',
    nullable: true,
  })
  reason: string

  // 备注
  @Column({
    type: 'varchar',
    name: 'remark',
    nullable: true,
  })
  remark: string

  // 是否已经入库
  @Column({
    type: 'tinyint',
    name: 'isInStore',
    nullable: true,
  })
  isInStore: boolean

  // 是否删除
  @Column({
    type: 'tinyint',
    name: 'isDelete',
    nullable: true,
  })
  isDelete: boolean
}
